package com.example.pojo;

import static javafx.scene.input.KeyCode.L;

public class Test {

    static void printBinaryInt(int a){
        System.out.println("int:"+a+",binary:");
        System.out.print("  ");
        for(int i=0;i<32;i++){
            int t=(a & 0x80000000>>>i)>>>(31-i);
            System.out.print(t);
        }
        System.out.println();
    }
    public static void main(String[] args){
        printBinaryInt(9);
        printBinaryInt(10);
        printBinaryInt(9^10);
        printBinaryInt(~9^10);
        printBinaryInt(Integer.MAX_VALUE);
//
//        printBinaryInt(-124);
//        printBinaryInt(-124-1);
//        printBinaryInt(-1);
//        printBinaryInt(~(-124-1));
        printBinaryInt(31);
        printBinaryInt(1<<30);
        printBinaryInt(1);
        printBinaryInt((1<<30)&1);
        printBinaryInt(Integer.MAX_VALUE);
        printBinaryInt((1<<30)&Integer.MAX_VALUE);

        System.out.println(Integer.toBinaryString(-1));


        int radix = 1 << 4;
        int mask = radix - 1;
        printBinaryInt(mask);
        printBinaryInt(-1);


    }
}
